import request from '@/utils/request';
import type {AddressADD, AddressInfoData, AddressUpdate, AddressUserData} from "@/api/address/type.ts";
import type {ShopInfo} from "@/api/shop/type.ts";
import {addressEditProps} from "vant";
enum API{
    ADDRESS_INFO='/DeliveryAddress/listDeliveryAddressByUserId',
    ADDRESS_USER='/DeliveryAddress/listDeliveryAddressByUserName',
    ADDRESS_ADD='/DeliveryAddress/saveDeliveryAddress',
    ADDRESS_UPDATE='/DeliveryAddress/updateDeliveryAddress',
    ADDRESS_DELETE='/DeliveryAddress/removeDeliveryAddress'
}

export const reqAddressInfo=(userId: string)=>request.get<any,AddressInfoData>(API.ADDRESS_INFO,{params: { userId }});

export const reqAddressUser=(contactName:string)=>request.get<any,AddressUserData>(API.ADDRESS_USER,{params:{contactName}})

//地址新增
export const AddAddress=(data:AddressADD)=>request.post<any,any>(API.ADDRESS_ADD, data);
//地址修改
export const UpdateAddress=(data:AddressUpdate)=>request.put<any,any>(API.ADDRESS_UPDATE,data);
//地址删除
export const DeleteAddress=(daId: number)=>request.delete<any,any>(API.ADDRESS_DELETE,{params: {daId}});